<?php 
$conn = oci_connect("gaurav", "gaurav", "xe"); 
$msg='hola';
$from='xw2174';
$to='gip2103';

do_query($conn, 'insert into Messages(MessageID,Mesg,fromcuid,tocuid) values(msgseq.nextval,'.$msg.','.$from.','.$to.')');

//insert in Messages values(msgseq.NEXTVAL,'Hellooo','agr2624','ax2624'

// Execute query and display results 
function do_query($conn, $query)
{
  $stid = oci_parse($conn, $query);
  $r = oci_execute($stid, OCI_DEFAULT);

  print '<table border="1">';
  while ($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) {
    print '<tr>';
    foreach ($row as $item) {
      print '<td>'.
            ($item ? htmlentities($item) : '&nbsp;').'</td>';
    }
    print '</tr>';
  }
  print '</table>';
}
?>